<template>
  <div class="richText" v-html="html"></div>
</template>
<script>
import { productInfo, productContent } from '@/api/api';
export default {
  data () {
    return {
      html: '',
      type: null,
      id: null
    };
  },
  mounted () {
    Object.assign(this.$data, this.$options.data());
    this.id = this.$mp.query.id;
    this.type = this.$mp.query.type ? this.$mp.query.type : null;
    wx.setNavigationBarTitle({
      title: Number(this.type) === 1 ? '风险揭示' : '项目详情'
    });
    this.productInfo();
  },
  onShow () {},
  methods: {
    async productInfo () {
      if (Number(this.type) === 1) {
        await productInfo({ id: this.id }).then(res => {
          this.html = res.product.riskHint;
        });
      } else {
        await productContent({ id: this.id }).then(res => {
          this.html = res.content;
        });
      }
    }
  }
};
</script>
<style lang="less" scoped>
.richText {
}
</style>